class Linkifier(object):
	@classmethod
	def _prepare_args(cls,args):
		if hasattr(cls,'_defaultargs'):
			newargs = list(cls._defaultargs)
			for i,arg in enumerate(args):
				if arg: newargs[i] = arg
			return newargs
		else:
			return args

	@classmethod
	def get_isvalid(cls, query, *args):
		if hasattr(cls,'_isvalid'):
			if callable(cls._isvalid):
				args = cls._prepare_args(args)
				return cls._isvalid(query, *args)
			else:
				return bool(cls._isvalid)
		else:
			return True
	
	@classmethod
	def get_link(cls, query, *args):
		if hasattr(cls,'_link'):
			if callable(cls._link):
				args = cls._prepare_args(args)
				return cls._link(query, *args)
			else:
				return str(cls._link)
		else:
			return None
	
